Skip to content

feat: add rank change indicators to leaderboard#95

Merged
jagdish-15 merged 6 commits into
codepvg:mainfrom
akshara200829-lgtm:feat/rank-change-indicators
Jun 5, 2026
Merged

feat: add rank change indicators to leaderboard#95
jagdish-15 merged 6 commits into
codepvg:mainfrom
akshara200829-lgtm:feat/rank-change-indicators

Conversation

@akshara200829-lgtm

Copy link
Copy Markdown
Contributor

Description

Adds rank change indicators to each leaderboard row showing movement since the last sync. Each row now displays [+N] in green (moved up), [-N] in red (dropped), [==] in dim (no change), or [NEW] in amber (first appearance), consistent with the terminal theme.

Linked Issue

Fixes #71

Changes Made

1.Added computeRankChanges() helper in scripts/sync-leaderboard.js that reads the existing leaderboard JSON before overwriting it, computes rank delta per user, and writes a rankChange field into the output JSON for all 4 tabs (overall, daily, weekly, monthly)
2.Added getRankChangeTag() in frontend/leaderboard.html that renders the indicator as a styled inline span
3.Injected the indicator into both desktop rows and mobile cards next to the rank number
Added CSS classes rank-up, rank-down, rank-neutral, rank-new using existing CSS variables

Type of Change

  • Bug fix
  • New feature
  • UI/Visual update
  • Documentation update
  • Refactor

Testing

  • Tested locally
  • Tested on mobile viewport (if applicable)
  • No console errors introduced

Checklist

  • My code follows the project's coding style
  • I have formatted my code locally using Prettier
  • I have performed a self-review of my code
  • My changes generate no new warnings or errors
  • I have updated documentation if required
  • I have linked the relevant issue

Screenshots / Screen Recording

Screenshot 2026-06-03 140844

Note: Rank change indicators are populated by the sync script at each sync cycle. Since the live JSON does not yet contain rankChange data, the screenshot above was captured by injecting mock values via DevTools console to verify the UI renders correctly. Indicators will appear automatically on the live leaderboard after the next sync runs with the updated script.

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Thank you for submitting a pull request.

Please ensure your changes comply with the project's contribution guidelines and that all workflow checks pass successfully.

A maintainer will review your submission shortly.

@jagdish-15 jagdish-15 added type:feature New feature or request level:intermediate Indicates the difficulty labels Jun 5, 2026

@jagdish-15 jagdish-15 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rank change indicator would fit better visually if it appeared after the user's name instead of directly beside the rank number.

Also for [NEW], use the same dimmed styling/intensity as the [==] indicator so it doesn't visually overpower the actual rank changes, and [new] would probably feel more subtle than [NEW].

About implementation logic, the rank change indicators themselves should ideally compare against the previous day's final leaderboard snapshot rather than just the immediately previous sync. That would make the movement indicators more stable and meaningful overall.

The immediately previous sync comparison could instead be better suited for the live sync-diff popup feature being discussed separately in issue #111, since that feature is specifically about showing what changed in the latest sync cycle.

@jagdish-15

Copy link
Copy Markdown
Collaborator

/format

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

I have successfully run Prettier and pushed the formatting fixes to this PR.

Note for Contributors: Because this commit was pushed by a bot, GitHub will not automatically re-run the CI checks. To trigger them to pass, you must either:

  • Push an empty commit locally (git commit --allow-empty -m "Trigger builds" and push)
  • Close and immediately reopen this Pull Request.

@jagdish-15 jagdish-15 merged commit 2efcdba into codepvg:main Jun 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved level:intermediate Indicates the difficulty type:feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Add rank change indicator (↑↓) to leaderboard rows using historical data

2 participants